using System;
using System.Collections;

namespace Deepcode.Flux.Core.Extensions.Codons
{
	/// <summary>
	/// The interface for the implementation of a codon tag. A codon is a special type of object
	/// that represents both an XML tag definition and the object it is responsible for building.
	/// Codon's are created in the addin tree as markers for the real objects the codon is responsible
	/// for building. When part of the tree is requested, any associated codons are asked to build
	/// the physical objects that they represent.
	/// </summary>
	public interface ICodon
	{
		/// <summary>
		/// Returns the ID of the tag - all tags in an addin definition must
		/// specify a unique ID.
		/// </summary>
		string ID { get; }
		/// <summary>
		/// Returns the class name of the tag. Optional. The class is the type
		/// of object to build usually for simple addin tags.
		/// </summary>
		string Class { get; }
		/// <summary>
		/// Get/Set the ID that the tag node should be inserted AFTER
		/// when the tree nodes are being built.
		/// </summary>
		string[] InsertAfter { get; set; }
		/// <summary>
		/// Get/Set the ID that the tag node should be insterted BEFORE
		/// when the tree nodes are being built.
		/// </summary>
		string[] InsertBefore { get; set; }
		/// <summary>
		/// Build the object that this addin tag represents, owned by the object
		/// owner passed in, and using the subitems specified in the arraylist.
		/// </summary>
		/// <param name="owner"></param>
		/// <param name="subItems"></param>
		/// <returns></returns>
		object BuildItem(object owner, ArrayList subItems);
	}
}
